package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.common.AreaControlVO;
import com.jwsoft.manager.common.vo.eduJhjyQuerySync.EduJhjyQuerySyncKeyVO;
import com.jwsoft.manager.common.vo.eduJhjyQuerySync.EduJhjyQuerySyncQueryVO;
import com.jwsoft.manager.common.vo.eduJhjyQuerySync.EduJhjyQuerySyncVO;
import com.jwsoft.manager.common.vo.eduJhjyQuerySync.JhjyQueryVO;
import com.jwsoft.manager.core.integration.EduJhjyQuerySyncIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 金华录取查询网关
 *
 * @author wangtao
 * @since 2023-03-16
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "金华录取查询", description = "金华录取查询")
public class EduJhjyQuerySyncController {

    @Autowired
    public EduJhjyQuerySyncIntegration eduJhjyQuerySyncIntegration;

    @Operation(summary = "金华录取查询分页查询",description = "金华录取查询分页查询")
    @PostMapping(value = "/eduJhjyQuerySync0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduJhjyQuerySyncVO>> getList(@RequestBody @Validated EduJhjyQuerySyncQueryVO vo) {
        return AppResponse.successData(eduJhjyQuerySyncIntegration.getList(vo));
    }

    @Operation(summary = "金华录取查询根据主键查询详情",description = "金华录取查询根据主键查询详情")
    @PostMapping(value = "/eduJhjyQuerySync0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjyQuerySyncVO> getById(@RequestBody @Validated EduJhjyQuerySyncKeyVO vo) {
        return AppResponse.successData(eduJhjyQuerySyncIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华录取查询新增",description = "金华录取查询新增")
    @PostMapping(value = "/eduJhjyQuerySync0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjyQuerySyncVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduJhjyQuerySyncVO vo) {
        return AppResponse.successData(eduJhjyQuerySyncIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华录取查询修改",description = "金华录取查询修改")
    @PostMapping(value = "/eduJhjyQuerySync0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjyQuerySyncVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduJhjyQuerySyncVO vo) {
        return AppResponse.successData(eduJhjyQuerySyncIntegration.edit(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "金华录取查询删除", description = "金华录取查询删除")
    @PostMapping(value = "/eduJhjyQuerySync0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduJhjyQuerySyncKeyVO vo) {
        eduJhjyQuerySyncIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华录取情况查询批量", description = "金华录取情况查询批量")
    @PostMapping(value = "/eduJhjyQuerySync0007", produces = "application/json;charset=UTF-8")
    public AppResponse createJhjySync(@RequestBody @Validated AreaControlVO vo) {
        eduJhjyQuerySyncIntegration.createJhjySync(vo);
        return AppResponse.successMsg("调用成功！");
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "金华录取查询新增", description = "金华录取查询新增")
    @PostMapping(value = "/eduJhjyQuerySync0008", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjyQuerySyncVO> query(@RequestBody @Validated(value = {Validators.Add.class}) EduJhjyQuerySyncQueryVO vo) {
        return AppResponse.successData(eduJhjyQuerySyncIntegration.query(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "根据证件号查询出最新同步记录", description = "根据证件号查询出最新同步记录")
    @PostMapping(value = "/eduJhjyQuerySync0009", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjyQuerySyncVO> querySyncByIdCard(@RequestBody JhjyQueryVO vo) {
        return AppResponse.successData(eduJhjyQuerySyncIntegration.querySyncByIdCard(vo));
    }
}
